package me.zhengjie.modules.deviceposition.service;

import me.zhengjie.modules.deviceposition.domain.DevicePosition;
import me.zhengjie.modules.deviceposition.service.dto.DevicePositionDTO;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

/**
 * @author 张鹏
 * @date 2019-06-05
 */
@CacheConfig(cacheNames = "devicePosition")
public interface DevicePositionService {

    /**
     * findById
     *
     * @param id
     * @return
     */
    @Cacheable(key = "#p0")
    DevicePositionDTO findById(Long id);

    /**
     * create
     *
     * @param resources
     * @return
     */
    @CacheEvict(allEntries = true)
    DevicePositionDTO create(DevicePosition resources);

    /**
     * update
     *
     * @param resources
     */
    @CacheEvict(allEntries = true)
    void update(DevicePosition resources);

    /**
     * delete
     *
     * @param id
     */
    @CacheEvict(allEntries = true)
    void delete(Long id);

    List<Map<String, String>> deviceDict();
}